Perform a query
Parent Type: LearningStoreJob
Namespace: Microsoft.LearningComponents.Storage
Assembly: Microsoft.LearningComponents.Storage.dll
| Exception type | Condition |
| ArgumentNullException | query is a null reference. |
| InvalidOperationException | query was not created from this LearningStore, or at least one output column was not specified in the query. |
Steps required to perform a query:
The System.Data.DataTable returned in the result contains one column for each output column added to the LearningStoreQuery using LearningStoreQuery.AddColumn. See LearningStoreQuery.AddCondition for a list of the possible types that are returned.
See the LearningStoreQuery documentation for more information about queries.
The following code performs a query to retrieve the names of all the users:
| C# |
// Create the query
LearningStoreQuery query = store.CreateQuery("UserItem");
// Add output columns to the query
query.AddColumn("Name");
// Create a job and add the "perform query" operation
LearningStoreJob job = store.CreateJob();
job.PerformQuery(query);
// Execute the job
DataTable result = job.Execute<DataTable>();
|
result contains a DataTable with one column named "Name." The DataTable contains one row for every user.